"""
URL configuration for dx_movie project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from movie.views import MovieViewSet, CategoryViewSet
from account.views import CollectViewSet

# 创建路由器并注册视图
router = DefaultRouter()
router.register(r'movies', MovieViewSet, basename='movie')
router.register(r'categories', CategoryViewSet, basename='category')
router.register(r'collects', CollectViewSet, basename='collect')

# 定义 URL 路由列表
urlpatterns = [
    # 设置 admin 管理路径
    path('admin/', admin.site.urls),
    path('api/auth/', include('djoser.urls')),  # 添加djoser的路径
    path('api/auth/', include('djoser.urls.jwt')),  # 添加JWT的路径
    # 设置 API 路径，包括注册的视图集路由
    path('api/', include(router.urls)),

]

